﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link href="../weblib/jquery.easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../weblib/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../weblib/jquery/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../weblib/jquery.easyui/jquery.easyui.min.js" type="text/javascript"></script>
      
    <script src="../weblib/jquery/jquery.adaptor.js" type="text/javascript"></script>
    <script src="../webjs/core/index.js" type="text/javascript"></script>
        <script type="text/javascript">
            var language = $.cookie('_language_');
            if (language == null || language == '') {
                document.write("<script src='../Language/sys_language/zh.js'><\/script>");
            }
            else if (Number(language) == 1) {
                document.write("<script src='../Language/sys_language/zh.js'><\/script>");
            }
            else if (Number(language) == 0) {
                document.write("<script src='../Language/sys_language/en.js'><\/script>");
            }
   </script>
  <script type="text/javascript">
      $(function () {
          $('#dg').datagrid({ singleSelect: false });
          $.ajaxHandler({
              url: "/tadongserviceweb/AjaxMappingHandler.aspx",
              urlType: "QueryThemeByThemeTypeId",
              model: function () {
                  return $.getPara('themetypeid');
              },
              success: function (data) {
                  if (data) {
                      data = JSON.parse(data);
                      $('#dg').datagrid("loadData", data);

                      $.each(data, function (idx, val) {//遍历JSON  
                          if (val.checked == "True") {
                              $("#dg").datagrid("selectRow", idx); //如果数据行为已选中则选中改行  
                          }
                      });

                      $(function () {
                          $(".zh_en").each(function () {
                              this.innerHTML = eval($(this).attr('rel'));
                          });
                         
                      });
                  }
              }
          });



      });

      function save() {

          var themetypeid = $.getPara('themetypeid');
          if (!themetypeid) {
              alert(lang.The_themeType_is_empty_please_contact_the_system_administrator);
              return;
          }
          var checkedItems = $('#dg').datagrid('getChecked');
          var themetypes = [];
          themetypes.push(themetypeid);
          $.each(checkedItems, function (index, item) {
              themetypes.push(item.SUBJ_ID);
          });

          themetypes = themetypes.join(",");

          $.ajaxHandler({
              url: "/tadongserviceweb/AjaxMappingHandler.aspx",
              urlType: "EditThemeType_themeInfo",
              model: function () {
                  return themetypes;
              },
              success: function (data) {
                  if (data) {
                      alert(lang.successfully_updated);
                  }
              }
             
          });

      }
      function exit() {

          parent.$.closePage();
      }
        
    </script>     

</head>
<body>

    <table id="dg" class="easyui-datagrid" title="" style="width:300px;height:300px"
            data-options="rownumbers:true,singleSelect:true,method:'get'">
        <thead>
            <tr>
                <th data-options="field:'CK',checkbox:true"><span class="zh_en" rel="lang.Choice"></span></th>
                <th data-options="field:'SUBJ_ID',width:80" hidden="true">SUBJ_ID</th>
                <th data-options="field:'SUBJ_NAME',width:150"><span class="zh_en" rel="lang.subjectName"></span></th>
                <th data-options="field:'PRORITY',width:80,align:'right'"><span class="zh_en" rel="lang.PRORITY"></span></th>
                
                
            </tr>
        </thead>
    </table>
   <div  style="padding:10px 20px;"></div>
 <div style="text-align:center;"><a id="btn" href="#" class="easyui-linkbutton" onclick="save();"><span class="zh_en" rel="lang.save"></span></a><span style="padding-left:20px;"><a href="#" class="easyui-linkbutton"  onclick="exit();"><span class="zh_en" rel="lang.close"></span></a></span></div>
</body>
</html>